<?php
try {
    $dbh = new PDO('mysql:host=127.0.0.1;dbname=bflh;port=3306', "bflh", "Hf123!@#");
    foreach($dbh->query('SELECT trx_started, trx_mysql_thread_id, trx_query FROM information_schema.innodb_trx;') as $row) {
        print_r($row);
    }
    //$dbh = null;
    $sql = "insert into `hf_mes_user` (name,user,note) values('小刚','14','男')";
    //$sql= "set global event_scheduler = on";
    //var_dump($sql);
    //$res = $dbh->exec($sql);
    //if($res){echo '成功添加 '.$res.' 条数据！';}
    
    $query = trim($sql);
    $dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
		$stmt =  $dbh->prepare($query);
		
		$stmt->execute();
   $i = 0;
		$ret = array();
		do{
			if($stmt->columnCount() > 0){
				//record detected;
				array_push($ret, $stmt->fetchAll(\PDO::FETCH_ASSOC));
			}
			 
		}while($stmt->nextRowset());
		$dbh->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false);
		var_dump($ret); 
   $dbh = null;
} catch (PDOException $e) {
    print "Error!: " . $e->getMessage() . "<br/>";
    die();
}
?>
